﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="../weblib/jquery/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../weblib/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../weblib/jquery.easyui/jquery.easyui.adaptor.js" type="text/javascript"></script>
    <link href="../weblib/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../weblib/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../weblib/skins/style.css" rel="stylesheet" type="text/css" />
    <script src="../WebFileExplorer/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <link href="../weblib/skins/layout.css" rel="stylesheet" type="text/css" />
    <link href="../weblib/skins/sexybuttons.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var language = $.cookie('_language_');
        if (language == null || language == '') {
            document.write("<script src='../Language/sys_language/zh.js'><\/script>");
        }
        else if (Number(language) == 1) {
            document.write("<script src='../Language/sys_language/zh.js'><\/script>");
        }
        else if (Number(language) == 0) {
            document.write("<script src='../Language/sys_language/en.js'><\/script>");
        }
        //遍历span标签
        $(function () {
            $(".zh_en").each(function () {
                this.innerHTML = eval($(this).attr('rel'));
            });
            //            $("#t1 a span")[0].innerHTML = lang.basic_information;
            //            $("#t2 a span")[0].innerHTML = lang.user_group;
        });

   </script>
    <script type="text/javascript">

        $(function () {

            var today = new Date();
            var m = today.getUTCMonth();
            var y = today.getFullYear();
            if (m == 12) {
                m = 1;
                y = y + 1;
            }
            else {
                m = m + 1;
            }

            var start = today.getFullYear() + "-" + today.getUTCMonth() + "-" + today.getDate();

            var end = y + "-" + m + "-" + today.getDate();

            $("#startDate").val(start);
            $("#endDate").val(end);

            $("#btnSearch").click(function () {
                $("#logTable").datagrid({
                    url: '../Handlers/LogHandler.aspx?op=search',
                    method: "post",
                    queryParams:
                {
                    startDate: $("#startDate").val(),
                    endDate: $("#endDate").val(),
                    logType: $("#logType").combobox("getValue")
                },
                    columns: [[
                    { field: "UserName",
                        title:lang.user_name,
                        width: 80,
                        align: 'center',
                        sortable: true
                    },
                    {
                        field: "UserAccount",
                        title: "账户",
                        width: 80,
                        align: 'center',
                        sortable: true
                    },
                    {
                        field: "OperateTime",
                        title: "操作时间",
                        width: 150,
                        align: 'center',
                        sortable: true
                    },
                    {
                        field: "LogDesc",
                        title: "日志内容",
                        width: 300,
                        align: 'center',
                        sortable: true
                    },
                    {
                        field: "IP",
                        title: "IP地址",
                        width: 200,
                        align: 'center',
                        sortable: true
                    }
                ]],
                    rownumbers: true,
                    animate: true,
                    fit: true,
                    pageSize: 20,
                    pagination: true,
                    singleSelect: true,
                    pagePosition: 'top',
                    striped: true,
                    remoteSort: false
                });

                //设置分页控件  
                var p = $('#logTable').datagrid('getPager');

                $(p).pagination({
                    pageSize: 20, //每页显示的记录条数，默认为10  
                    pageList: [20, 30], //可以设置每页记录条数的列表  
                    beforePageText: '第', //页数文本框前显示的汉字  
                    afterPageText: '页    共 {pages} 页',
                    //displayMsg: '',
                    displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'

                });

            });

            $("#btnExport").click(function () {
                //导出Excel
                $.post({
                url:'../Handlers/LogHandler.aspx?op=search',
                });

                $.ajax({
                    url: "../Handlers/LogHandler.aspx?op=export",
                    type: 'post',
                    dataType: 'json',
                    data: { 
                        startDate: $("#startDate").val(),
                        endDate: $("#endDate").val(),
                        logType: $("#logType").combobox("getValue")
                    },
                    success: function () {
                        alert('导出成功！');
                    }
                });
            });

            $("#btnSearch").click();

        });

        
    </script>
</head>
<body >
        <div style=" background-color:rgb(245,245,245); margin-bottom:1px;">
        <span style=" margin-right:4px;">日志类型 </span><span>
            <select id="logType" class="easyui-combobox" style="width: 200px;">
                <option value="Login">登录</option>
                <option value="Logout">注销</option>
                <option value="Insert">添加数据</option>
                <option value="Delete">删除数据</option>
                <option value="Update">更新数据</option>
                <option value="Search">搜索文档</option>
                <option value="ScanFile">在线浏览文档</option>
                <option value="DownFile">下载文档</option>
                <option value="DeleteFile">删除文档</option>
            </select>
        </span>
        <span>
            起始日期
        </span>
        <span>
            <input id="startDate" type="text" onclick="WdatePicker()" />
        </span>
        <span>截止日期</span>
        <span>
            <input id="endDate" type="text" onclick="WdatePicker()"  />
        </span>

        <span>
            <a id="btnSearch" href="#" class="easyui-linkbutton" >查询</a>
            
            <a id="btnExport" href="#" class="easyui-linkbutton" >导出</a>

            <!--<a id="btnClear" href="#" class="easyui-linkbutton" >清空日志</a>-->
        </span>
    </div>
    <table id="logTable">
    </table>
</body>
</html>
